home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 865 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: lrz-muenchen.de!sun2!ua302aa
  2. From: ua302aa@sun2.lrz-muenchen.de (Kurt Watzka)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: HELP! File Pointers
  5. Date: 9 Jan 1996 10:23:42 GMT
  6. Organization: Leibniz-Rechenzentrum, Muenchen (Germany)
  7. Distribution: world
  8. Message-ID: <4ctfne$8lq@sparcserver.lrz-muenchen.de>
  9. References: <4csr4c$fem@newsbf02.news.aol.com>
  10. NNTP-Posting-Host: sun2.lrz-muenchen.de
  11.  
  12. roberino@aol.com (Roberino) writes:
  13.  
  14. >I am currently trying to keep one file open while opening other
  15. >files one at a time using a separate file pointer.  However, as
  16.  
  17. >Here are the steps I am performing:
  18.  
  19. >void main()
  20. I will not comment on this!
  21. >{
  22. >    FILE *File1;
  23. >    FILE *File2;
  24.  
  25. >    File1 =   fopen("FILENAME", "r+");
  26. >    
  27. >    /* loop through lines in File1 using fgets() */
  28.  
  29. >    if (Condition) /* just indicating some condition was met */
  30. >    {
  31. >        File2 = fopen("FILENAME2", "r+");
  32. >      
  33. >        fgets(Line, File2); <----- As soon as this occurs, File1 gets
  34. >                                          wiped out.  Why?
  35.  
  36. The fgets() function in the standard C library takes three arguments.
  37. Your's doesn't, and there is no indication that there is a prototype
  38. for fgets() in scope. Line is undefined. So, what should be done with
  39. this program? It does not compile, and since you are obviously not 
  40. talking about the fgets() function from the standard C library, what
  41. should we assume about "fgets()"?
  42.  
  43. >    }
  44. >}
  45.  
  46. >Please send any and all replies through email to
  47. >                roberino@aol.com.
  48. >I appreciate any and all help.
  49.  
  50. If you also offer to post a summary, your chances to get E-mail
  51. replies micht improve slightly.
  52.  
  53. Kurt
  54. --
  55. | Kurt Watzka                             Phone : +49-89-2180-6254
  56. | watzka@stat.uni-muenchen.de
  57. | ua302aa@sunmail.lrz-muenchen.de
  58.